-
-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ID's to <style>
tags
#336
Conversation
|
Codecov Report
@@ Coverage Diff @@
## master #336 +/- ##
==========================================
+ Coverage 98.43% 98.88% +0.45%
==========================================
Files 4 5 +1
Lines 64 90 +26
Branches 21 26 +5
==========================================
+ Hits 63 89 +26
Misses 1 1
Continue to review full report at Codecov.
|
options.attrs[key] = options.attrs[key] | ||
.replace(/\[name\]/ig, pkg.name) | ||
.replace(/\[version\]/ig, pkg.version); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need use loader-utils.interpolateName
(https://github.com/webpack/loader-utils#interpolatename).
Also find-package
doesn't works good with mono repos, please don't use this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find-package
has been removed.- But loader-utils.interpolateName is unsatisfactory. We need to get the version number of the package corresponding to the current file.
- is there a better way to get it than from package.json?
test: add utils.test
Why you need version here? Better add this attribute using own configuration, it is not universal solution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #317 for a possible solution to add the url (as id) (data-id
/data-url
) in a more generic way to the <style>
tags. Using your current approach searching for the package and using the package name as an id instead isn't a generic solution and it should also be avoided to use fs
from within a loader. webpack already gives us the request (url) and we can manipulate it to get an acceptable identifier
Closing due to inactivity feel free to reopen once the requested chances are addressed :) |
Lets say I have 2 standalone apps. Each one needs to check whether the css libraries it needs have been loaded prior to loading them. If I load app 1, and this loads some css libs that app 2 also will use, without a method of identifying the css I have imported, how can I identify if the css has already been loaded? I think the only good way is with this feature. |
fix: #216